function isValid(s: string): boolean {
  let arr: string[] = [];
  for (let i = 0; i < s.length; i++) {
    switch (s[i]) {
      case "{":
        arr.push("{");
        break;
      case "[":
        arr.push("[");
        break;
      case "(":
        arr.push("(");
        break;
      case ")":
        if (arr.length === 0 || arr.pop() !== "(") return false;
        break;
      case "}":
        if (arr.length === 0 || arr.pop() !== "{") return false;
        break;
      case "]":
        if (arr.length === 0 || arr.pop() !== "[") return false;
        break;
      default:
        return false;
    }
  }
  return true;
}
console.log(isValid("()[]{}"));
